package com.lujianfei.tiananyungu.shopmanager

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.lujianfei.tiananyungu.MyApplication
import com.lujianfei.tiananyungu.utils.AssetHelper

/**
 * Author: lujianfei
 * Date: 2024/6/23 03:25
 * Description:
 */
class ShopDataManager private constructor() {
    companion object {
        val instance by lazy { ShopDataManager() }
    }
    fun load():List<Restaurant> {
        val jsonStr = AssetHelper.readTextFromAssets(MyApplication.instance, "shop.json")
        val typeToken = object :TypeToken<List<Restaurant>>(){}.type
        return Gson().fromJson(jsonStr, typeToken)
    }
}


data class Restaurant(
     val name: String,
     val type: String,
     val sub_type: String,
     val sub_sub_type: String?,
     val area: String,
     val building: String,
     val block: String,
     val floor: String
)